package com.powersi.hygeia.framework.jdbclogger.oracle10g;

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 */

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.Properties;
import java.util.logging.Logger;

import oracle.jdbc.driver.OracleConnection;

import com.powersi.hygeia.framework.jdbclogger.AbstractWrapperDriver;
import com.powersi.hygeia.framework.jdbclogger.formatters.NumberParameterFormatterImpl;
import com.powersi.hygeia.framework.jdbclogger.formatters.OracleDateParameterFormatterImpl;

/**
 * @author Martin Marinschek (latest modification by $Author: sorin7486 $)
 * @version $Revision: 115 $ $Date: 2007-07-19 11:41:41 +0200 (Thu, 19 Jul 2007) $
 */
public class OracleDriverWrapper extends AbstractWrapperDriver {
    // This driver is compatible with the Oracle 10g release2 jdbc Driver

    public OracleDriverWrapper() {
        super();
        formatters.add(new OracleDateParameterFormatterImpl());
        formatters.add(new NumberParameterFormatterImpl());
    }

    public Connection connect(String s, Properties properties) throws SQLException {
        if (getDriver() == null)
            return null;

        // has to return null if no connection available for compliance with the JDBC appi
        OracleConnection con = (OracleConnection) getDriver().connect(s, properties);
        if (con != null)
            return new OracleConnectionWrapper(con, formatters);
        return null;

    }

	@Override
	public Logger getParentLogger() throws SQLFeatureNotSupportedException {
		// TODO Auto-generated method stub
		return null;
	}
}
